<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改密码</title>
    <link rel="stylesheet" href="/index.css"/>
    <script src="/js/vue.js"></script>
    <script src="/index.js"></script>
    <script src="/js/axios.min.js"></script>
</head>
<body>
<div id="app">
    <div class="container">
    <el-form  label-width="150px" >
        <el-form-item label="原密码/新密码">
            <el-input  show-password v-model="app.applicant_pass"></el-input>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="updatePass">修改</el-button>
        </el-form-item>
    </el-form>


</div>
</div>

</body>
</html>
<script>
    var vm=new Vue({
        el: "#app",
        data: {
            app:{

            },
        },
        methods: {
    updatePass:function (){
        var applicant_id = window.localStorage.getItem("applicant_id")
        var applicant_pass = window.localStorage.getItem("applicant_pass")
        console.log(this.app)
        axios.post('/app/update3', this.app)
            .then(function (response) {
                console.log(response.data);
                if(response.data==1){
                    alert("修改成功！")
                    location.href="3.html"
                }
            })
            .catch(function (error) {
                console.log(error);
            });

            },
        },
        mounted() {
            var _this = this
            var applicant_id = window.localStorage.getItem("applicant_id")
            console.log("主键为："+ applicant_id)
            axios.get('/app/update2',{
                params:{
                    applicant_id: applicant_id
                }
            })
                .then(function (response){
                    _this.app = response.data
                    console.log(response.data);
                })
                .catch(function (error){
                    console.log(error);
                });
            //this.$forceUpdate()

        },
    })

</script>

<style>
    .container{
    position: absolute;
    top: 40%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    -o-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    }
    .el-input {
        width: 230px;
    }
    .el-input-group__prepend {
        background-color: #fff;
    }

    body > .el-container {
        margin-bottom: 40px;
    }

    .el-container:nth-child(5) .el-aside,
    .el-container:nth-child(6) .el-aside {
        line-height: 260px;
    }

    .el-container:nth-child(7) .el-aside {
        line-height: 320px;
    }

    .linkage {display: flex;}

    div { margin-right: 5px }
</style>